'use strict';
exports.main = async (event, context) => {
	//event为客户端上传的参数
	const db = uniCloud.database()
	const $ = db.command.aggregate
  let type = await db.collection("books").aggregate().unwind('$tags').sortByCount(`$tags`).end()
	//返回数据给客户端
	return type
};
